<template>
    <!-- 移动端下拉刷新插件 -->
    <Scroll
          ref="scroll"
            :autoUpdate="true"

          @pullingUp="loadMore">
        <slot>

        </slot>
    </Scroll>
</template>

<script>
import Scroll from 'vue-slim-better-scroll'

export default {
    name:'VScrollView',
    props:{
        lists:{
          type:Array,
          default(){
              return []
          }  
        },
        /**
         * 当数据更新后，刷新scroll的延时。
         */
         refreshDelay: {
            type: Number,
            default: 20
        },
        page:{
            type:Object,
            default(){
                return {
                    pageNo:1,
                    pageSize:10,
                    total:0
                }
            }
        },


    },
    components:{
        Scroll
    },
    data(){
        return {
            
        }
    },
    mounted() {
 
    },
    methods: {
        loadMore(){
            this.page.pageNo++;
            if(this.page.pageNo * this.page.pageSize > this.page.total){
                this.$refs.scroll.update(true);
                return
            }
            this.$emit('loadMore',this.page);
            this.$nextTick(()=>{
              this.$refs.scroll.update(false);
            })
        },
    },
    watch: {
      

    }
}
</script>


<style scoped lang='scss'>
.wrapper{
    width:100%;
    height: 100%;
}
</style>